<template>
	<view class="common-list flex animated fadeIn fast">
		<!-- 左边 -->
		<view class="common-list-l">
			<image :src="item.userpic" mode="widthFix" lazy-load></image>
		</view>
		<view class="common-list-r">
			<view>
				<view class="flex-ac flex-sp-ac">
					<!-- 左 -->
					<view class="flex-ac">
						{{item.username}}
						<tagSexAge :sex="item.sex" :age="item.age"></tagSexAge>
					</view>
					<!-- 右 -->
					<view style="margin-top: 20rpx;">
						<view v-if="!item.isguanzhu" class="concern" @tap="concernChange()">
							<view class="icon iconfont icon-zengjia">
								关注
							</view>
						</view>
						<view v-if="item.isguanzhu" class="unconcern" @tap="concernChange()">
							已关注
						</view>
					</view>
				</view>
				<view class="common-list-r-time">14天前</view>
			</view>
			<view>{{item.title}}</view>
			<view class="flex-sc-ac" style="flex-direction:column;">
				<!-- 图片 -->
				<block v-for="(pic,index) in item.morepic" :key="index">
					<image :src="pic" mode="widthFix" lazy-load @tap="imgdetail(index)" style="margin-bottom: 20rpx;"></image>
				</block>
				
				<!-- 视频 -->
				<template v-if="item.video">
					<view class="common-list-play icon iconfont icon-bofang"></view>
					<view class="common-list-playinfo">
						{{item.video.looknum}} 万次播放 {{item.video.long}}
					</view>
				</template>
				
				<!-- 分享 -->
				<!-- <template v-if="item.share">
					<view class="common-list-share flex-ac">
						<image :src="item.share.titlepic" mode="widthFix" lazy-load></image>
						<view>{{item.share.title}}</view>
					</view>
				</template> -->
			</view>
			<view class="flex-ac flex-sp-ac">
				<view>{{item.path}}</view>
				<view class="flex-ac">
					<view class="icon iconfont icon-zhuanfa">{{item.sharenum}}</view>
					<view class="icon iconfont icon-pinglun1">{{item.commentnum}}</view>
					<view class="icon iconfont icon-dianzan1">{{item.goodnum}}</view>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	import tagSexAge from "../common/tag-sex-age"
	export default {
		props:{
			item:Object
		},
		data() {
			return {
				isguanzhu:this.item.isguanzhu
			}
		},
		methods:{
			concernChange() {
				this.item.isguanzhu = !this.item.isguanzhu;
				if (this.item.isguanzhu == true) {
					uni.showToast({
						title: '关注成功'
					});
				} else {
					uni.showToast({
						title: '取消关注'
					});
				}
			},
			imgdetail(index) {
				//预览图片
				uni.previewImage({
					current:index,
					urls:this.item.morepic
				})
			}
		},
		components:{
			tagSexAge
		}
	}
</script>

<style scoped>
	@import "../../common/list.css";
	.common-list-r{
		border-bottom: 0;
	}
	.common-list{
		border-bottom: 1rpx solid #EEEEEE;
	}
	.common-list-r-time{
		padding: 15rpx 0;
		color: #CCCCCC !important;
		font-size: 25rpx;
		background: #FFFFFF  !important;
	}
	.concern {
		background-color: #09BB07;
		color: #F1F1F1;
		display: flex;
		align-items: center;
		border-radius: 6%;
		padding: 7rpx;
		margin-right: 10rpx;
	}
	
	.unconcern {
		background-color: #FFB846;
		color: #F1F1F1;
		display: flex;
		align-items: center;
		border-radius: 6%;
		padding: 7rpx;
		margin-right: 10rpx;
	}
</style>
